

package com.jf.cloud.delivery.controller.app;

import com.jf.cloud.api.delivery.vo.DeliveryOrderFeignVO;
import com.jf.cloud.api.order.feign.OrderFeignClient;
import com.jf.cloud.common.response.ServerResponseEntity;
import com.jf.cloud.delivery.service.DeliveryOrderService;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author
 */
@RestController("appMyDeliveryController")
@RequestMapping("/my_delivery")
@Tag(name = "app-我的物流接口")
public class MyDeliveryController {

    @Autowired
    private DeliveryOrderService deliveryOrderService;

    @Autowired
    private OrderFeignClient orderFeignClient;
    /**
     * 物流查询接口
     */
    @GetMapping("/order_info/{orderId}")
    @Operation(summary = "物流查询接口" , description = "根据orderNumber查询订单所有包裹信息")
    public ServerResponseEntity<List<DeliveryOrderFeignVO>> info(@PathVariable("orderId") String orderId) {
        List<DeliveryOrderFeignVO> deliveryOrders = deliveryOrderService.getByDeliveryByOrderId(Long.parseLong(orderId));
        return ServerResponseEntity.success(deliveryOrders);
    }

    @GetMapping("/delivery_order/{deliveryOrderId}")
    @Operation(summary = "物流包裹查询接口" , description = "根据orderDeliveryId查询订单包裹信息")
    @Parameter(name = "deliveryOrderId", description = "订单物流包裹id" )
    public ServerResponseEntity<DeliveryOrderFeignVO> info(@PathVariable("deliveryOrderId") Long deliveryOrderId) {
        DeliveryOrderFeignVO deliveryOrder = deliveryOrderService.deliveryOrderItemInfo(deliveryOrderId);
        return ServerResponseEntity.success(deliveryOrder);
    }


}
